<?php
class sfBreadcrumbSection {
	
	private $actions;

	private $symfony_name;

	private $display_name;
	
	private $module;
	
	public function __construct($symfony_name, $display_name, sfBreadcrumbModule $module) {
		
		$this->symfony_name = $symfony_name;

		$this->display_name = $display_name;
		
		$this->module = $module;
		
	}
	
	public function getLink() {
		
		// load required helpers
		sfContext::getInstance()->getConfiguration()->loadHelpers(array('Breadcrumbs', 'Url', 'Tag', 'I18N'));
		
		return link_to( __($this->display_name), $this->module->getSymfonyName().'/'.$this->symfony_name );
		
	}

	public function getSymfonyName() {

		return $this->symfony_name;

	}

	public function setSymfonyName($symfony_name) {

		if(is_string($symfony_name)) {

			$this->symfony_name = $symfony_name;

		}

	}

	public function getDisplayName() {

		return $this->display_name;

	}

	public function setDisplayName($display_name) {

		if(is_string($display_name)) {

			$this->display_name = $display_name;

		}

	}

	public function getActions() {
		
		return $this->actions;
		
	}

	public function getAction($action_name) {
		
		foreach($this->actions as $action) {
			
			if( $action->getSymfonyName() == $action_name ){
				
				return $action;
				
			}
			
		}
		
	}
	
	public function setActions(array $actions) {

		$this->actions = $actions;

	}
	
	public function getModule() {
		
		return $this->module;
		
	}
	
	public function setModule(sfBreadcrumbModule $module) {
		
		$this->module = $module;
		
	}
	
}
